<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="button" value="删除" onclick="del();" />
	<input type="button" value="添加" onclick="add();" />
	<input type="button" value="更新" onclick="save();" />
	<ul> 
		<li>春雨</li>
		<li>夏荷</li>
		<li>秋月</li>
		<li>冬梅</li>
	</ul>
</body>
<script type="text/javascript">
		function del(){
			var ul = document.getElementsByTagName('ul')[0];
			var li = ul.children[ul.children.length-1];
			ul.removeChild(li);
		}

	function add(){
		var ul = document.getElementsByTagName('ul')[0];
		var li = document.createElement('li');
		ul.appendChild(li);
		var content = document.createTextNode('夏日');
		li.appendChild(content);
	}
	
	function save(){
		var li = "<li>北京</li><li>上海</li><li>天津</li><li>重庆</li><li>香港</li><li>澳门</li>";
		var ul = document.getElementsByTagName('ul')[0];
		ul.innerHTML = li;
	}
</script>
</html>